package com.hwd;


import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @Author huangweidong
 * @Date 2022/7/23 14:27
 */
public class test {

    public static void main(String[] args) {
        String[] a = new String[]{"1", "2"};
        System.out.println(Arrays.toString(a));
    }

    public static void main1(String[] args) {
        List<String> columnDb = new ArrayList<>(Arrays.asList("姓名", "年龄", "性别", "头像"));
        List<String> columnInput = new ArrayList<>(Arrays.asList("姓名", "年龄", "头像", "地址", "手机号", "头像"));
        Set<String> columnSet = new HashSet<>(columnInput);
        List<String> strings = new ArrayList<>(columnSet);

        List<String> errorColumns = columnInput.stream().filter(v -> !columnDb.remove(v)).collect(Collectors.toList());
        List<String> columnDis = errorColumns.stream().filter(strings::remove).collect(Collectors.toList());

        System.out.println("columnDb = " + columnDb);
        System.out.println("errorColumns = " + errorColumns);
        System.out.println("columnDis = " + columnDis);
        System.out.println("columnSet = " + columnSet);
        System.out.println("strings = " + strings);

        String msg = "";
        if (StringUtils.isEmpty("关键词1") || StringUtils.isEmpty("关键词1来源")) {
            if (StringUtils.isEmpty("关键词1")) {
                msg += "关键词1为空";
            }
            if (StringUtils.isEmpty("关键词1来源")) {
                msg += "关键词1来源为空";
            }
        }

        if ((StringUtils.isEmpty("关键词2") || StringUtils.isEmpty("关键词2来源") || StringUtils.isEmpty("关键词2逻辑关系"))
                && (!StringUtils.isEmpty("关键词2") || StringUtils.isEmpty("关键词2来源") || StringUtils.isEmpty("关键词2逻辑关系"))) {
            if (StringUtils.isEmpty("关键词2")) {
                msg += "关键词2为空";
            }
            if (StringUtils.isEmpty("关键词2来源")) {
                msg += "关键词2来源为空";
            }
            if (StringUtils.isEmpty("关键词2逻辑关系")) {
                msg += "关键词2逻辑关系为空";
            }
        }


//        Map<String, String> map = new HashMap<>();
//        map.put("姓名", "张三");
//        map.put("年龄", "23");
//        map.put("头像", "imageUrl");
//        map.put("性别", "男");
//        map.put("手机号", "150xxxxxxxx");
//        map.put("地址", "imageUrl");

//        List<String> errorColumns = map.keySet().stream()
//                .filter(v -> !columnDb.remove(v))
//                .columnDis(Collectors.toList());
//        System.out.println("columnDb = " + columnDb);
//        System.out.println("errorColumns = " + errorColumns);
    }
}
